package aerolineasYVuelos

import javax.persistence.Entity
import javax.persistence.Inheritance
import javax.persistence.InheritanceType
import javax.persistence.DiscriminatorValue
import javax.persistence.DiscriminatorColumn
import javax.persistence.DiscriminatorType
import javax.persistence.Id
import javax.persistence.GeneratedValue
import javax.persistence.GenerationType

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(      name="tipo_categoria",
  discriminatorType=DiscriminatorType.STRING      )
abstract class Categoria {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	var id: Int = _
	def getId = id
    def setId(i: Int) { id = i }
	
	def porcentajeDeRecarga: Double
}

@Entity
class Turista extends Categoria {
	def porcentajeDeRecarga = 0.05
}

@Entity
class Bussines extends Categoria {
	def porcentajeDeRecarga = 0.1
}

@Entity
class Primera extends Categoria {
	def porcentajeDeRecarga = 0.25
}